package spec.zhangyuehua.$05;

import java.util.LinkedList;

/**
 * Created by yue on 2017/11/14.
 */
public class Example5_4 {
    //成员属性
    LinkedList l=new LinkedList();
    //构造方法
    private void push(Object o){
        l.addFirst(o);
    }
    //成员方法
    public Object pop(){
        return l.removeLast();
    }
    public Object peek(){
        return  l.getLast();
    }
    int size(){
        int i=l.size();
        return i;
    }
    public boolean empty(){
        return l.isEmpty();
    }
    public static void main(String[] args) {
        Example5_4 stack=new Example5_4();
        stack.push("王小二");
        stack.push("张小三");
        stack.push("李小四");
        System.out.println(stack.pop());
        System.out.println(stack.peek());
        System.out.println(stack.pop());
        System.out.println(stack.size());
        System.out.println(stack.empty());
    }
}
